Skip to content

Conversation

@haroon0x
Copy link

@haroon0x haroon0x commented Oct 26, 2025

Description

Implement logprobs support in chat_models.py to ChatGoogleGenerativeAI

Relevant issues

Fixes #718

Type

πŸ†• New Feature
βœ… Test

Changes(optional)

Files changed chat_models.py and test_chat_models.py

Testing(optional)

Added test_logprobs function in test_chat_models.py

Note(optional)

Copy link

@hossam1522 hossam1522 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@haroon0x haroon0x changed the title feat(genai) : Add logprobs support to ChatGoogleGenerativeAI feat(genai): Add logprobs support to ChatGoogleGenerativeAI Oct 26, 2025
@mdrxy mdrxy changed the title feat(genai): Add logprobs support to ChatGoogleGenerativeAI feat(genai): add logprobs support Nov 10, 2025
"""Stop sequences for the model."""

logprobs: int | None = None
"""The number of logprobs to return."""
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this correct? It doesn't appear to affect output for me. Setting to 0 (or False) also appears to still keep chosen_candidates

@mdrxy
Copy link
Collaborator

mdrxy commented Nov 10, 2025

I also think we ought to mention the instability of the param

https://discuss.ai.google.dev/t/logprobs-is-not-enabled-for-gemini-models/107989/15
vercel/ai#5418

I can't get newer Gemini models (2.5) to return logprobs via the genai API either

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Logprobs support

3 participants